﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Luna.Framework.Manifest {
	public class PluginManifestProcessor : IManifestProcessor {

		public bool isSupport(IConfigurationManifest manifest, Type hostManifestType) {
			return "plugin".Equals(manifest.Name) && manifest.Parent != null && manifest.Parent.Name.Equals("application");
		}

		public bool process(IManifestManager manager, IConfigurationManifest manifest, object host, IAppContext context) {
			string extManifest = manifest.getProperty("manifest", "");
			if (extManifest.isNotNullAndEmpty() && extManifest.fileExists())
				manager.loadManifest(extManifest);
			return true;
		}
	}
}
